home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / Oberon⁄F™ 1.1 / Obx / Mod / IFS (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-01-05  |  2.6 KB  |  80 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. Helvetica
  17. MODULE ObxIFS;
  18.     IMPORT ObxRandom, In, Out, XYplane;
  19.         a1, b1, c1, d1, e1, f1, p1: REAL;
  20.         a2, b2, c2, d2, e2, f2, p2: REAL;
  21.         a3, b3, c3, d3, e3, f3, p3: REAL;
  22.         a4, b4, c4, d4, e4, f4, p4: REAL;
  23.         X, Y: REAL;
  24.         x0: INTEGER;
  25.         y0: INTEGER;
  26.         e: INTEGER;
  27.         initialized: BOOLEAN;
  28.     PROCEDURE Draw*;
  29.         VAR x, y: REAL; xi, eta: INTEGER; rn: REAL;
  30.     BEGIN
  31.         IF initialized THEN
  32.             REPEAT
  33.                 rn := ObxRandom.Uniform();
  34.                 IF rn < p1 THEN
  35.                     x := a1 * X + b1 * Y + e1; y := c1 * X + d1 * Y + f1
  36.                 ELSIF rn < (p1 + p2) THEN
  37.                     x := a2 *X + b2 * Y + e2; y := c2 * X + d2 * Y + f2
  38.                 ELSIF rn < (p1 + p2 + p3) THEN
  39.                     x := a3 * X + b3 * Y + e3; y := c3 * X + d3 * Y + f3
  40.                 ELSE
  41.                     x := a4 * X + b4 * Y + e4; y := c4 * X + d4 * Y + f4
  42.                 END;
  43.                 X := x; xi := x0 + SHORT(ENTIER(X * e));
  44.                 Y := y; eta := y0 + SHORT(ENTIER(Y * e));
  45.                 XYplane.Dot(xi, eta, XYplane.draw)
  46.             UNTIL "s" = XYplane.ReadKey()
  47.         END
  48.     END Draw;
  49.     PROCEDURE Init*;
  50.     BEGIN
  51.         X := 0; Y := 0;
  52.         initialized := FALSE;
  53.         In.Open;
  54.         In.Int(x0); In.Int(y0); In.Int(e);
  55.         In.Real(a1); In.Real(a2); In.Real(a3); In.Real(a4);
  56.         In.Real(b1); In.Real(b2); In.Real(b3); In.Real(b4);
  57.         In.Real(c1); In.Real(c2); In.Real(c3); In.Real(c4);
  58.         In.Real(d1); In.Real(d2); In.Real(d3); In.Real(d4);
  59.         In.Real(e1); In.Real(e2); In.Real(e3); In.Real(e4);
  60.         In.Real(f1); In.Real(f2); In.Real(f3); In.Real(f4);
  61.         In.Real(p1); In.Real(p2); In.Real(p3); In.Real(p4);
  62.         IF In.Done THEN XYplane.Open; initialized := TRUE
  63.         ELSE Out.String("Parameter error"); Out.Ln
  64.         END
  65.     END Init;
  66. BEGIN
  67.     initialized := FALSE
  68. END ObxIFS.
  69. TextControllers.StdCtrlDesc
  70. TextControllers.ControllerDesc
  71. Containers.ControllerDesc
  72. Controllers.ControllerDesc
  73. TextRulers.StdRulerDesc
  74. TextRulers.RulerDesc
  75. TextRulers.StdStyleDesc
  76. TextRulers.StyleDesc
  77. TextRulers.AttributesDesc
  78. Helvetica
  79. Documents.ControllerDesc
  80.